require('../../assets/js/property.js')
require('../../assets/css/index.less')
require('./my.less')
require('swiper/dist/css/swiper.min.css')
const Swiper=require('swiper')
//引入请求工具
const request = require('../../assets/js/requers')
//引入tabbar渲染函数
const renderTabbar = require('../../assets/js/tabbar')
//服务器地址
const API = 'http://fitness.h5.itsource.cn:3701'
window.onload = () => {
  let mySwiper = new Swiper(".swiper-container", {
    autoplay : 5000,
    loop:true,
    pagination : '.swiper-pagination',
  });
  //渲染tabbar
  renderTabbar('my')
  //获取用户信息
  function getUserInfo() {
    request.get('/api/user/info').then(res => {
      //1 解构数据
      let {errno, data} = res.data
      //2 判断
      if (errno === 0) {
        //3 处理业务逻辑
        render(data)
      }
    })
  }

  //渲染数据
  function render(data) {
    //图片渲染 服务器地址+相对路径+文件名
    $('.imgBox').src = API + data.imgUrl
  }

  //初始化获取用户信息
  getUserInfo()
}

